package pl.edu.pw.elka.jtrzasko.proz.warcaby.actions.server;

import javax.swing.SwingUtilities;

import pl.edu.pw.elka.jtrzasko.proz.warcaby.messages.server.ServerMessage;
import pl.edu.pw.elka.jtrzasko.proz.warcaby.messages.server.ServerMessageActivePlayer;
import pl.edu.pw.elka.jtrzasko.proz.warcaby.view.ClientView;

public class ServerActionActivePlayer extends ServerAction {

	public void run(final ClientView clientView, final ServerMessage message){
		SwingUtilities.invokeLater(new Runnable()
		{
			public void run()
			{
				if (((ServerMessageActivePlayer)message).getColor() == clientView.getClientColor())
				{
					clientView.getTextClientStatus().setText("Your move !");
					clientView.setClientMove(true);
				} else
				{
					clientView.getTextClientStatus().setText("Opponent move...");
					clientView.setClientMove(false);
				}
			}
		});
	}

}
